.class public Lcom/philzhu/www/framework/impl/MultiTouchHandler;
.super Ljava/lang/Object;
.source "MultiTouchHandler.java"

# interfaces
.implements Lcom/philzhu/www/framework/impl/TouchHandler;


# instance fields
.field isTouched:[Z

.field scaleX:F

.field scaleY:F

.field touchEventPool:Lcom/philzhu/www/framework/Pool;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Lcom/philzhu/www/framework/Pool",
            "<",
            "Lcom/philzhu/www/framework/Input$TouchEvent;",
            ">;"
        }
    .end annotation
.end field

.field touchEvents:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Lcom/philzhu/www/framework/Input$TouchEvent;",
            ">;"
        }
    .end annotation
.end field

.field touchEventsBuffer:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Lcom/philzhu/www/framework/Input$TouchEvent;",
            ">;"
        }
    .end annotation
.end field

.field touchX:[I

.field touchY:[I


# direct methods
.method public constructor <init>(Landroid/view/View;FF)V
    .locals 3
    .parameter "view"
    .parameter "scaleX"
    .parameter "scaleY"

    .prologue
    const/16 v2, 0x14

    .line 24
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 15
    new-array v1, v2, [Z

    iput-object v1, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->isTouched:[Z

    .line 16
    new-array v1, v2, [I

    iput-object v1, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchX:[I

    .line 17
    new-array v1, v2, [I

    iput-object v1, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchY:[I

    .line 19
    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    iput-object v1, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEvents:Ljava/util/List;

    .line 20
    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    iput-object v1, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEventsBuffer:Ljava/util/List;

    .line 25
    new-instance v0, Lcom/philzhu/www/framework/impl/MultiTouchHandler$1;

    invoke-direct {v0, p0}, Lcom/philzhu/www/framework/impl/MultiTouchHandler$1;-><init>(Lcom/philzhu/www/framework/impl/MultiTouchHandler;)V

    .line 31
    .local v0, factory:Lcom/philzhu/www/framework/Pool$PoolObjectFactory;,"Lcom/philzhu/www/framework/Pool$PoolObjectFactory<Lcom/philzhu/www/framework/Input$TouchEvent;>;"
    new-instance v1, Lcom/philzhu/www/framework/Pool;

    const/16 v2, 0x64

    invoke-direct {v1, v0, v2}, Lcom/philzhu/www/framework/Pool;-><init>(Lcom/philzhu/www/framework/Pool$PoolObjectFactory;I)V

    iput-object v1, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEventPool:Lcom/philzhu/www/framework/Pool;

    .line 32
    invoke-virtual {p1, p0}, Landroid/view/View;->setOnTouchListener(Landroid/view/View$OnTouchListener;)V

    .line 34
    iput p2, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->scaleX:F

    .line 35
    iput p3, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->scaleY:F

    .line 36
    return-void
.end method


# virtual methods
.method public getTouchEvents()Ljava/util/List;
    .locals 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Lcom/philzhu/www/framework/Input$TouchEvent;",
            ">;"
        }
    .end annotation

    .prologue
    .line 138
    monitor-enter p0

    .line 139
    :try_start_0
    iget-object v2, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEvents:Ljava/util/List;

    invoke-interface {v2}, Ljava/util/List;->size()I

    move-result v1

    .line 140
    .local v1, len:I
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    if-lt v0, v1, :cond_0

    .line 142
    iget-object v2, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEvents:Ljava/util/List;

    invoke-interface {v2}, Ljava/util/List;->clear()V

    .line 143
    iget-object v2, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEvents:Ljava/util/List;

    iget-object v3, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEventsBuffer:Ljava/util/List;

    invoke-interface {v2, v3}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z

    .line 144
    iget-object v2, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEventsBuffer:Ljava/util/List;

    invoke-interface {v2}, Ljava/util/List;->clear()V

    .line 145
    iget-object v2, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEvents:Ljava/util/List;

    monitor-exit p0

    return-object v2

    .line 141
    :cond_0
    iget-object v3, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEventPool:Lcom/philzhu/www/framework/Pool;

    iget-object v2, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEvents:Ljava/util/List;

    invoke-interface {v2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/philzhu/www/framework/Input$TouchEvent;

    invoke-virtual {v3, v2}, Lcom/philzhu/www/framework/Pool;->free(Ljava/lang/Object;)V

    .line 140
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 138
    .end local v0           #i:I
    .end local v1           #len:I
    :catchall_0
    move-exception v2

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v2
.end method

.method public getTouchX(I)I
    .locals 1
    .parameter "pointer"

    .prologue
    .line 118
    monitor-enter p0

    .line 119
    if-ltz p1, :cond_0

    const/16 v0, 0x14

    if-lt p1, v0, :cond_1

    .line 120
    :cond_0
    :try_start_0
    monitor-exit p0

    const/4 v0, 0x0

    .line 122
    :goto_0
    return v0

    :cond_1
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchX:[I

    aget v0, v0, p1

    monitor-exit p0

    goto :goto_0

    .line 118
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public getTouchY(I)I
    .locals 1
    .parameter "pointer"

    .prologue
    .line 128
    monitor-enter p0

    .line 129
    if-ltz p1, :cond_0

    const/16 v0, 0x14

    if-lt p1, v0, :cond_1

    .line 130
    :cond_0
    :try_start_0
    monitor-exit p0

    const/4 v0, 0x0

    .line 132
    :goto_0
    return v0

    :cond_1
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchY:[I

    aget v0, v0, p1

    monitor-exit p0

    goto :goto_0

    .line 128
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public isTouchDown(I)Z
    .locals 1
    .parameter "pointer"

    .prologue
    .line 108
    monitor-enter p0

    .line 109
    if-ltz p1, :cond_0

    const/16 v0, 0x14

    if-lt p1, v0, :cond_1

    .line 110
    :cond_0
    :try_start_0
    monitor-exit p0

    const/4 v0, 0x0

    .line 112
    :goto_0
    return v0

    :cond_1
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->isTouched:[Z

    aget-boolean v0, v0, p1

    monitor-exit p0

    goto :goto_0

    .line 108
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public onTouch(Landroid/view/View;Landroid/view/MotionEvent;)Z
    .locals 10
    .parameter "v"
    .parameter "event"

    .prologue
    const/4 v9, 0x1

    .line 40
    monitor-enter p0

    .line 41
    :try_start_0
    invoke-virtual {p2}, Landroid/view/MotionEvent;->getAction()I

    move-result v6

    and-int/lit16 v0, v6, 0xff

    .line 42
    .local v0, action:I
    invoke-virtual {p2}, Landroid/view/MotionEvent;->getAction()I

    move-result v6

    const v7, 0xff00

    and-int/2addr v6, v7

    shr-int/lit8 v4, v6, 0x8

    .line 43
    .local v4, pointerIndex:I
    invoke-virtual {p2, v4}, Landroid/view/MotionEvent;->getPointerId(I)I

    move-result v3

    .line 46
    .local v3, pointerId:I
    packed-switch v0, :pswitch_data_0

    .line 100
    :cond_0
    :goto_0
    :pswitch_0
    monitor-exit p0

    .line 102
    return v9

    .line 50
    :pswitch_1
    const-string v6, "%%%%%%%%%%%%%"

    const-string v7, "real Action_down"

    invoke-static {v6, v7}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 52
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEventPool:Lcom/philzhu/www/framework/Pool;

    invoke-virtual {v6}, Lcom/philzhu/www/framework/Pool;->newObject()Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Lcom/philzhu/www/framework/Input$TouchEvent;

    .line 53
    .local v5, touchEvent:Lcom/philzhu/www/framework/Input$TouchEvent;
    const/4 v6, 0x0

    iput v6, v5, Lcom/philzhu/www/framework/Input$TouchEvent;->type:I

    .line 54
    iput v3, v5, Lcom/philzhu/www/framework/Input$TouchEvent;->pointer:I

    .line 55
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchX:[I

    .line 56
    invoke-virtual {p2, v4}, Landroid/view/MotionEvent;->getX(I)F

    move-result v7

    iget v8, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->scaleX:F

    mul-float/2addr v7, v8

    float-to-int v7, v7

    aput v7, v6, v3

    .line 55
    iput v7, v5, Lcom/philzhu/www/framework/Input$TouchEvent;->x:I

    .line 57
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchY:[I

    .line 58
    invoke-virtual {p2, v4}, Landroid/view/MotionEvent;->getY(I)F

    move-result v7

    iget v8, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->scaleY:F

    mul-float/2addr v7, v8

    float-to-int v7, v7

    aput v7, v6, v3

    .line 57
    iput v7, v5, Lcom/philzhu/www/framework/Input$TouchEvent;->y:I

    .line 59
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->isTouched:[Z

    const/4 v7, 0x1

    aput-boolean v7, v6, v3

    .line 60
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEventsBuffer:Ljava/util/List;

    invoke-interface {v6, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_0

    .line 40
    .end local v0           #action:I
    .end local v3           #pointerId:I
    .end local v4           #pointerIndex:I
    .end local v5           #touchEvent:Lcom/philzhu/www/framework/Input$TouchEvent;
    :catchall_0
    move-exception v6

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v6

    .line 69
    .restart local v0       #action:I
    .restart local v3       #pointerId:I
    .restart local v4       #pointerIndex:I
    :pswitch_2
    :try_start_1
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEventPool:Lcom/philzhu/www/framework/Pool;

    invoke-virtual {v6}, Lcom/philzhu/www/framework/Pool;->newObject()Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Lcom/philzhu/www/framework/Input$TouchEvent;

    .line 70
    .restart local v5       #touchEvent:Lcom/philzhu/www/framework/Input$TouchEvent;
    const/4 v6, 0x1

    iput v6, v5, Lcom/philzhu/www/framework/Input$TouchEvent;->type:I

    .line 71
    iput v3, v5, Lcom/philzhu/www/framework/Input$TouchEvent;->pointer:I

    .line 72
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchX:[I

    .line 73
    invoke-virtual {p2, v4}, Landroid/view/MotionEvent;->getX(I)F

    move-result v7

    iget v8, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->scaleX:F

    mul-float/2addr v7, v8

    float-to-int v7, v7

    aput v7, v6, v3

    .line 72
    iput v7, v5, Lcom/philzhu/www/framework/Input$TouchEvent;->x:I

    .line 74
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchY:[I

    .line 75
    invoke-virtual {p2, v4}, Landroid/view/MotionEvent;->getY(I)F

    move-result v7

    iget v8, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->scaleY:F

    mul-float/2addr v7, v8

    float-to-int v7, v7

    aput v7, v6, v3

    .line 74
    iput v7, v5, Lcom/philzhu/www/framework/Input$TouchEvent;->y:I

    .line 76
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->isTouched:[Z

    const/4 v7, 0x0

    aput-boolean v7, v6, v3

    .line 77
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEventsBuffer:Ljava/util/List;

    invoke-interface {v6, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_0

    .line 85
    .end local v5           #touchEvent:Lcom/philzhu/www/framework/Input$TouchEvent;
    :pswitch_3
    invoke-virtual {p2}, Landroid/view/MotionEvent;->getPointerCount()I

    move-result v2

    .line 86
    .local v2, pointerCount:I
    const/4 v1, 0x0

    .local v1, i:I
    :goto_1
    if-ge v1, v2, :cond_0

    .line 87
    move v4, v1

    .line 88
    invoke-virtual {p2, v4}, Landroid/view/MotionEvent;->getPointerId(I)I

    move-result v3

    .line 90
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEventPool:Lcom/philzhu/www/framework/Pool;

    invoke-virtual {v6}, Lcom/philzhu/www/framework/Pool;->newObject()Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Lcom/philzhu/www/framework/Input$TouchEvent;

    .line 91
    .restart local v5       #touchEvent:Lcom/philzhu/www/framework/Input$TouchEvent;
    const/4 v6, 0x2

    iput v6, v5, Lcom/philzhu/www/framework/Input$TouchEvent;->type:I

    .line 92
    iput v3, v5, Lcom/philzhu/www/framework/Input$TouchEvent;->pointer:I

    .line 93
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchX:[I

    .line 94
    invoke-virtual {p2, v4}, Landroid/view/MotionEvent;->getX(I)F

    move-result v7

    iget v8, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->scaleX:F

    mul-float/2addr v7, v8

    float-to-int v7, v7

    aput v7, v6, v3

    .line 93
    iput v7, v5, Lcom/philzhu/www/framework/Input$TouchEvent;->x:I

    .line 95
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchY:[I

    .line 96
    invoke-virtual {p2, v4}, Landroid/view/MotionEvent;->getY(I)F

    move-result v7

    iget v8, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->scaleY:F

    mul-float/2addr v7, v8

    float-to-int v7, v7

    aput v7, v6, v3

    .line 95
    iput v7, v5, Lcom/philzhu/www/framework/Input$TouchEvent;->y:I

    .line 97
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/MultiTouchHandler;->touchEventsBuffer:Ljava/util/List;

    invoke-interface {v6, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 86
    add-int/lit8 v1, v1, 0x1

    goto :goto_1

    .line 46
    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_1
        :pswitch_2
        :pswitch_3
        :pswitch_2
        :pswitch_0
        :pswitch_1
        :pswitch_2
    .end packed-switch
.end method
